import React, { Component } from 'react'
import {Redirect, Switch, Route, HashRouter }from 'react-router-dom'
import './index.css'
import SideMenu from './SideMenu'
import TopHeader from './TopHeader'
import Home from '../pages/home/home'
import UserIndex from '../pages/user/UserIndex'
import Posting from '../pages/posting/Posting'
import Comments from '../pages/comments/Comments'
import Question from '../pages/question/Question'
import { Layout } from 'antd'
const {Content} = Layout
export default class index extends Component {
  render() {
    return (
      <Layout>
        <SideMenu></SideMenu>
        <Layout className="site-layout">
          <TopHeader></TopHeader>
          <Content className="site-layout-background"
            style={{
            margin: '24px 16px',
            padding: 24,
            minHeight: 280,
            overflow:"auto"
            }}>
            <HashRouter>
              <Switch>
                <Route path='/home' component={Home} /> 
                <Route path='/posting' component={Posting} />
                <Route path='/comments' component={Comments} />
                <Route path='/question' component={Question} />
                <Route path='/user' component={UserIndex} />
                <Redirect from='/' to="/home" exact />
              </Switch>
            </HashRouter>
          </Content>
        </Layout>
      </Layout>
    )
  }
}
